package com.suo.test;

import com.suo.mapper.ProductInfoMapper;
import com.suo.pojo.ProductInfo;
import com.suo.pojo.vo.ProductInfoVo;
import com.suo.utils.MD5Util;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:applicationContext_dao.xml","classpath:applicationContext_service.xml"})
public class test {

    private ProductInfoMapper mapper;

    @Autowired
    public void setMapper(ProductInfoMapper mapper) {
        this.mapper = mapper;
    }

    @Test
    public void test() {
        String mi = MD5Util.getMD5("123456");

        System.out.println(mi);

        System.out.println(mi.length());
    }

    @Test
    public void test2() {
        ProductInfoVo vo = new ProductInfoVo();
        vo.setPname("4");
        vo.setTypeid(1);
        vo.setLprice(800);
        vo.setHprice(1000);
        List<ProductInfo> productInfos = mapper.selectCondition(vo);
        for (ProductInfo info : productInfos) {
            System.out.println(info);
        }

    }
}
